n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
vis = [[0] * n for _ in range(n)]
dir = [(0, 1), (0, -1), (1, 0), (-1, 0)]
path_list = ''  # 记录路径

def dfs(x, y, path):
    # 标记占位
    vis[x][y] = 1
    a[y] -= 1
    b[x] -= 1
    global path_list
    # 剪枝，当大索引已达标小索引仍未达标，不满足
    if a[y] == 0:
        if sum(a[0:y]) > 0:
            return
    if b[x] == 0:
        if sum(b[0:x]) > 0:
            return

    # 终点判断，如果符合条件记录并返回，不符合条件不记录返回
    if x == y == n - 1:
        if sum(a) + sum(b) == 0:
            path_list = path
            return
        else:
            return

    for i, j in dir:
        nx, ny = x + i, y + j
        if 0 <= nx < n and 0 <= ny < n and not vis[nx][ny] and a[ny] > 0 and b[nx] > 0:
            dfs(nx, ny, path + '/' + str(n * nx + ny))
            vis[nx][ny] = 0
            a[ny] += 1
            b[nx] += 1

dfs(0, 0, '0')
for i in path_list.split('/'):
    print(i, end = ' ')